package com.tiantian.novel.model;


import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Novel 概要
 *
 * @author wangkai
 * @since 2020/12/17.
 */
@Data
public class NovelSummary implements Serializable {
    private String title;
    private String author;
    private String status;
    private String updateTime;
    private String homePage;
    private String code;
    private String logo;
    private List<ChapterInfo> chapters = new ArrayList<>();

    public NovelSummary() {
    }

    public NovelSummary(String code,
                        String homePage,
                        String title,
                        String author,
                        String status,
                        String updateTime,
                        String logo) {
        this.homePage = homePage;
        this.title = title;
        this.author = author;
        this.status = status;
        this.updateTime = updateTime;
        this.code = code;
        this.logo = logo;
    }

    public NovelSummary add(ChapterInfo chapter) {
        this.chapters.add(chapter);
        return this;
    }

    @Override
    public String toString() {
        return "Novel{" +
                "\nhomePage='" + homePage + '\'' +
                "\nlogo='" + logo + '\'' +
                "\ncode='" + code + '\'' +
                "\ntitle='" + title + '\'' +
                "\nauthor='" + author + '\'' +
                "\nchapters:'" + chapters.size() + "章\'" +
                "\nstatus='" + status + '\'' +
                "\nupdateTime='" + updateTime + '\'' +
                "\n}";
    }
}
